#ifndef _DevicesM3_S_H_
#define _DevicesM3_S_H_

typedef enum {
    M3SStart = 0,
    M3SSucceed,
    M3SError,

    M3SHead,
    M3SReserved,
    M3SLength,
    M3SData,
    M3SCehckSum,
}M3SMachineEnum;




#if 0

#define M3S_FRAME_LEGNTH 32
#define M3S_FRAME_HEAD   0x424D
#define M3S_DATA_LEGNTH  26

typedef struct
{
    uint16_t head;
    uint16_t length;
    uint16_t reserve0;
    uint16_t concentration;
    uint16_t reserve1;
    uint16_t reserve2;
    uint16_t reserve3;
    uint16_t reserve4;
    uint16_t count_10_50um;
    uint16_t count_50_200um;
    uint16_t count_200_500um;
    uint16_t count_500_1000um;
    uint16_t count_1m;
    uint16_t reserve5;
    uint16_t reserve6;
    uint16_t checkSum;

    uint8_t lengthRead;
    uint8_t state;
}M3SFrameDef;

typedef union
{
    M3SFrameDef frame;
    uint8_t data[M3S_FRAME_LEGNTH];
}M3STypeDef;

#else /* 杉川自研传感器 */

#define M3S_FRAME_LEGNTH 5
#define M3S_FRAME_HEAD   0xAA

typedef struct
{
    uint8_t head;
    uint8_t reserved;
    uint8_t length;
    uint8_t checkSum;
    uint16_t value;

    uint8_t lengthRead;
    uint8_t state;
}M3STypeDef;

#endif



M3SMachineEnum enumM3SDecode(M3STypeDef *ptypeData, uint8_t ucValue);
int8_t cM3SSetInfo(M3STypeDef *ptypeData);
M3STypeDef *typeM3SGetInfo(void);

#endif
